import React, { Component } from 'react'
import {withRouter} from 'react-router-dom'

class Header extends Component {
  render() {
    return (
      <div className="page-header">
        <h2>React Router Demo</h2>
        <button onClick={() => this.props.history.goBack()}>回退</button>
        <button onClick={() => this.props.history.goForward()}>前进</button>
        <button onClick={() => this.props.history.go(2)}>原地踏步</button>
      </div>
    )
  }
}
// withRouter可以接收一个一般组件，并且在这个组件上加上路由组件的相关属性
export default withRouter(Header)
